<%@ page language="java" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>修改口令</title>
<jsp:include page="jqgrid.jsp"></jsp:include>
</head>
<script type="text/javascript">
	function submit() {
		var oldpwd= $("#oldpwd").val();
		var newpwd= $("#newpwd").val();
		var newpwd1= $("#newpwd1").val();
		if(newpwd!=newpwd1){
			alert("新口令输入不一致，请重新输入");
		}else{
			$.ajax({
				type : "post",
				url : "editPwd.action",
				dataType : "json",
				data : {
					oldpwd : oldpwd,
					newpwd : newpwd
				},
				success : function(data) {
					if (data.success) {
						alert(data.msg);
						cancel();
					} else {
						alert(data.msg);
					}
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					alert(errorThrown);
				}
			});
		}
	}
	function cancel() {
		window.close();
	}
</script>
<body>
	<table align="center">
		<tr>
			<td>原始口令</td>
			<td><input type="password" id="oldpwd" name="oldpwd" /></td>
		</tr>
		<tr>
			<td>新口令</td>
			<td><input type="password" id="newpwd" name="newpwd" /></td>
		</tr>
		<tr>
			<td>再次确认</td>
			<td><input type="password" id="newpwd1" name="newpwd1" /></td>
		</tr>
		<tr>
			<td><input type="button" name="submit" onclick="submit();"
				value="确认" /></td>
			<td><input type="button" name="cancel" onclick="cancel();"
				value="取消" /></td>
		</tr>
	</table>
</body>
</html>
